// 个人页面的仓库
import { makeAutoObservable } from "mobx";
const token = JSON.parse(localStorage.getItem('token'))
class userStore {
    constructor() {
        makeAutoObservable(this)
    }
    // 默认的昵称
    unLoginInNickName =  token ? token.name : ''
    unLoginInImg = 'https://ts3.cn.mm.bing.net/th?id=OIP-C._d7X2cP9wykTED6GQXIXTQHaHm&w=246&h=253&c=8&rs=1&qlt=90&o=6&dpr=1.1&pid=3.1&rm=2'

    LoginInNickName = token ? token.name : ''
    LoginInImg='https://tse3-mm.cn.bing.net/th/id/OIP-C.0fRrz1A8P2v9jZ9qpJEi0gAAAA?w=204&h=204&c=7&r=0&o=5&dpr=1.1&pid=1.7'
    myId = token ? token.id : ''
    houseArr = []
    city = ''
    community = ''
    area = ''
    type = ''
    forward = ''
    floor = ''
    door = ''
    img = ''
    isLogin = token ? true : false
    nickName = token ? token.name : ''
    role = token ? token.role : 0
    like = token ? token.like : []
    // 修改昵称1
    changeNickName(nickNmae) {
        this.nickName = nickNmae
    }
    // 登录成功调这个
    changeLogin(params){
        const {name,id,role,like} = params
        this.isLogin = true
        this.LoginInNickName = name
        this.nickName = name
        this.myId = id
        this.role = role
        this.like = like
    }
}

export default new userStore()